<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of admin
 *
 * @author QUYET
 */
class admin extends Admin_Controller {
    //put your code here
    public function __construct() {
        parent::__construct();
        $this->load->model('admin_m');
    }
    function index(){
        $this->listing();
    }
    function listing($status=3){
        $this->session->set_userdata('current_url', current_url());
        $this->_data['module_title'] = __('admin_ticket_order');
        $off_set = $this->uri->segment(5) != '' ? $this->uri->segment(5) : 0;
        $per_page = 10;
        $config['full_tag_open'] = "<div class='page'>";
        $config['full_tag_close'] = '</div>';
        $config['cur_tag_open'] = '<span> ';
        $config['cur_tag_close'] = ' </span>';
        $config['next_link'] = __('admin_next');
        $config['prev_link'] = __('admin_previous');
        $config['first_link'] = __('admin_first');
        $config['last_link'] = __('admin_last');
        $config['base_url'] = base_url() . 'admin/invoices/listing/'.$status.'/';
        $config['per_page'] = $per_page;
        $config['uri_segment'] = 5;
        $config['total_rows'] = $this->admin_m->count_invoices($status);
        $this->_data['invoices'] = $this->admin_m->get_invoices($status,$per_page,$off_set);
        $this->pagination->initialize($config);
        $this->_data['pagination'] = $this->pagination->create_links();
        $this->_data['selected_status'] = $status;
        $this->display_admin('admin/listing');
    }
    
    function invoice_details($id_invoice=0){
        if(empty($id_invoice)) redirect('admin/invoices');
        $this->session->set_userdata('current_url', current_url());
        $this->_data['invoice_details'] = $this->admin_m->get_invoice_details($id_invoice);
        $this->_data['module_title'] = __('admin_detail_for_invoice_number').' : '.$id_invoice;
        $this->display_admin('admin/invoice_details');
    }
}

?>
